home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Arsenal Files 8
/
The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO
/
dosutils
/
tsbat50.zip
/
DOSTRICK.TXT
< prev
next >
Wrap
Internet Message Format
|
1996-05-26
|
12KB
From ts@uwasa.fi Sun May 26 00:00:00 1996
Subject: Dostricks file information
Assorted MS-DOS Tricks Sun 26-May-1996
======================
All rights reserved
Copyright (c) 1994-1996 by Timo Salmi
....................................................................
Prof. Timo Salmi Co-moderator of news:comp.archives.msdos.announce
Moderating at ftp:// & http://garbo.uwasa.fi archives 193.166.120.5
Department of Accounting and Business Finance ; University of Vaasa
ts@uwasa.fi http://uwasa.fi/~ts BBS 961-3170972; FIN-65101, Finland
....................................................................
┌───────────────────────────────────────────────────────────┐
│ This file belongs to TSBAT*.ZIP. Please do not distribute │
│ this dostrick.txt file separately! If you see this file │
│ alone on a BBS, please alert the SysOp immediately. │
└───────────────────────────────────────────────────────────┘
You are free to quote brief passages from this file provided you
clearly indicate the source with a proper acknowledgment.
Comments and corrections are solicited. But if you wish to have
individual MS-DOS usage consultation, please rather post your
question to a Usenet newsgroup like news:comp.os.msdos.misc. It is
much more efficient than asking me by email. I'd like to help, but I
am very pressed for time. I prefer to pick the questions I answer
from the Usenet news. Thus I can answer publicly at one go if I
happen to have an answer. Besides, newsgroups have a number of
readers who might know a better or an alternative answer. Don't be
discouraged, though, if you get a reply like this from me. I am
always glad to hear from fellow MS-DOS users.
--------------------------------------------------------------------
From ts@uwasa.fi Sun May 26 00:00:01 1996
Subject: Dostricks index
INDEX
=====
1) Disabling MS-DOS commands
2) Simulating disk partitioning
3) A config.sys and autoexec.bat example
4) Stepping through config.sys and autoexec.bat command by command
5) Getting rid of "Insert diskette for drive B:"
6) Conditional deleting of files
7) Selected Doskey macro examples
--------------------------------------------------------------------
From ts@uwasa.fi Sun May 26 00:00:02 1996
Subject: Disabling MS-DOS commands
1. Disabling MS-DOS commands
============================
You may wish to disable certain MS-DOS commands for security reasons
to prevent them from being used either accidentally or deliberately.
If you have a command line editor, like doskey, then the disabling
is rather straightforward. All you have to do is to create a macro
with the same name as the MS-DOS command. Consider the following
examples. The first example disables the internal MS-DOS date
command so that the date on your system cannot be changed.
doskey date=rem date has been disabled
The second example disables the format command.
doskey format=rem format has been disabled
Note that since format is an external command, that is it is a
program on your disk, not a command in your command.com command
interpreter, you can still invoke it by giving the explicit path to
it like
c:\dos\format
In fact, since it will be at path, a drive letter will suffice. Of
course it is very easy to get rid of these redefinitions. In using
doskey, you only have to press alt+F10 to clear the macros.
If you use some other command line editor than doskey then the
commands are naturally slightly different. For example were you to
use CED (ftp://garbo.uwasa.fi/pc/cmdutil/ced10da.zip) the commands
would be
ced syn date echo date has been disabled
Restoring the date command would be
ced clear syn date
--------------------------------------------------------------------
From ts@uwasa.fi Sun May 26 00:00:03 1996
Subject: Simulating disk partitioning
2. Simulating disk partitioning
===============================
Since I have more than one PC at my disposal, I have noticed that it
is very useful to have some common standard on them including
similar disk names. For example I always assume that R: is my
ramdisk. Also I usually have my hard disk partitioned so that I have
a fairly fixed usage for C: D: E: and F:. One of the PCs is an ICL
laptop, with a 120Mb disk all on C: with no partitioning. below is
what I have in my autoexec.bat to have the ram disk reference the
way I want and to simulate the disk partitioning. Note the
importance of the order of the substitute commands because of the
double usage of D, since that is where the ram disk _originally_
resides on my ICL configuration.
c:\dos\subst r: d:\
c:\dos\subst d: c:\d
c:\dos\subst e: c:\e
c:\dos\subst f: c:\f
--------------------------------------------------------------------
From ts@uwasa.fi Sun May 26 00:00:04 1996
Subject: Bootfile examples
3. A config.sys and autoexec.bat example
========================================
There always is something to learn from looking at the other users'
config.sys and autoexec.bat files. Here are mine from my office 486
with MS-DOS 5.0. I have added some comments for you.
DEVICE=C:\DOS\SETVER.EXE
DEVICE=C:\DOS\HIMEM.SYS
DOS=UMB
device=c:\dos\emm386.exe /noems /i=e000-efff /x=d200-d600
dos=high
COUNTRY=032,,C:\DOS\COUNTRY.SYS
FILES=30
rem RamDrive of 7Mb, 128Kb sectorsize, 256 entries, extended memory
devicehigh=c:\dos\ramdrive.sys 7000 128 256 /e
rem ZANSI.SYS is from ftp://garbo.uwasa.fi/pc/screen/zansi12.zip
devicehigh=c:\sys\zansi.sys
rem Define a bigger environment size
shell=c:\command.com /p /e:1024
lastdrive=z
@ECHO OFF
rem Description: My normal MsDos 5.0 boot with Scrollit
rem Note below the trick to identify which of my PCs I am currently using:
set pcid_=karvi
rem Yellow text on black background
echo <ESC>[40;33;1m
PATH C:\DOS;c:\tools;e:\arczip
rem DAILY.EXE is from /pc/ts/tsbat46.bat to run a mini-backup
rem call c:\bat\daily c:\tools\pkzip -u d:\root\root c:\*.*
PROMPT $p$g
rem CHKSUM is from ftp://garbo.uwasa.fi/pc/goldies/chksum16.zip
c:\tools\chksum command.com 49024 io.sys 9850 msdos.sys 5750
loadhigh c:\dos\KEYB SU,,C:\DOS\KEYBOARD.SYS
rem The Command line EDitor is from /pc/goldies/ced.zip
loadhigh c:\tools\ced -B384,128,768,128,128 -Fced.cfg
rem The TSR memory management until is from /pc/memutil/tsrcom35.zip
c:\tools\mark scrollit
rem The screen scrollback buffer is from /pc/screen/scrlit18.zip
loadhigh c:\tools\scrollit /n=myname /k=myid 60
rem The Snipper screen capture is from /pc/goldies/snippr24.zip
loadhigh c:\tools\snipper
rem The cut and paste utility is from /pc/pcmagvol/vol11n07.zip
loadhigh c:\tools\dosclip2
rem The CapsLock fix is from /pc/ts/tstsr20.zip
loadhigh c:\tuki\shftcaps
c:\dos\subst r: j:\
mkdir r:\cmand
copy c:\command.com r:\cmand
c:\dos\attrib +r r:\cmand\command.com
set comspec=r:\cmand\command.com
set temp=r:\cmand
c:\dos\mode con: rate=32 delay=1
rem The clock comparison check is from /pc/ts/tsutil42.zip
c:\tools\dtetimal 1994
r:
--------------------------------------------------------------------
From ts@uwasa.fi Sun May 26 00:00:05 1996
Subject: Tracing boot files
4. Stepping through config.sys and autoexec.bat command by command
==================================================================
MS-DOS 6.0 introduced the possibility of pausing at each line of
config.sys and even selecting if the line is executed. If you press
F8 when your PC is being booted and displays "Starting MS-DOS...",
then "MS-DOS will prompt you to confirm each CONFIG.SYS command". If
you have an earlier MS-DOS version, you can still put pauses in your
config.sys by utilizing
6333 Jan 23 1993 ftp://garbo.uwasa.fi/pc/sysutil/pausedev.zip
pausedev.zip PAUSE for config.sys (with TP source) D.Murdoch
To step through autoexec.bat you can use the following trick
@echo off
set debug_=true
command1
if "%debug_%" == "true" pause
command2
if "%debug_%" == "true" pause
command3
set debug_=
If you have MS-DOS 6.0 or later you can use the CHOICE command to
prompt whether you want a command to be executed. If you have an
earlier MS-DOS version you can use "CHOOSE.EXE Ask questions in
batch files" from the ftp://garbo.uwasa.fi/pc/ts/tsutlf15.zip (or
ASK.EXE from ftp://garbo.uwasa.fi/pc/ts/tsbat48.zip). Below is an
outline example
@echo off
set debug_=true
if not "%debug_%" == "true" goto _comm1
CHOOSE /c:yn /n "Execute command1 [Y/N]? "
if not errorlevel==3 if errorlevel==2 goto _next2
:_comm1
command1
:_next2
if not "%debug_%" == "true" goto _comm2
CHOOSE /c:yn /n "Execute command2 [Y/N]? "
if not errorlevel==3 if errorlevel==2 goto _next3
:_comm2
command2
:_next3
(and so on)
set debug_=
--------------------------------------------------------------------
From ts@uwasa.fi Sun May 26 00:00:06 1996
Subject: One floppy drive blues
5. Getting rid of "Insert diskette for drive B:"
================================================
Q: On my one-floppy-drive PC how can I get rid of the message
"Insert diskette for drive B: and press any key when ready"?
A: The answer is simple as can be. Put the following command into
your AUTOEXEC.BAT file: "SUBST B: A:\". It makes B: point to the one
floppy drive (A:) you have on your system.
--------------------------------------------------------------------
From ts@uwasa.fi Sun May 26 00:00:07 1996
Subject: Conditional del command
6. Conditional deleting of files
================================
This is an improved adaptation of the tip in the PC Computing
Special Issue, 1001 tips, August 1994, pp. 106-232.
If you have MS-DOS 5+ you can utilize this simple doskey macro to
move files to a trash directory. First ensure that such a directory
exists and if not, mkdir it.
doskey del=if exist $1 copy $1 r:\trash$Tif not exist $1 echo
File $1 not found^G$Tif exist $1 del $1 /p
where all the above is on the SAME line.
You can precede the command with loadhigh to save conventional
memory. I have r: as ramdisk so the trash directory will
automatically be erased when I turn off the computer, or when it
chooses to crash :-).
--------------------------------------------------------------------
From ts@uwasa.fi Sun May 26 00:00:08 1996
Subject: Doskey macros
7. Selected Doskey macro examples
=================================
Here is a collection of my useful Doskey macros. They are reasonably
simple. You'll learn by working them out in detail. Be somewhat
careful in experimenting. Make test files to try then on rather than
running them on your existing files.
a) To go up one directory level.
doskey up=if exist ..\nul cd ..
b) Move a file to another directory.
doskey mv=if exist $2\nul copy $1 $2$Tif exist $2\nul del $1 /p
c) Prevent accidental formats.
doskey format=echo Bugger off^G^G^G
(Tip: to format, give the full path. Usually c:\dos\format)
d) Touch a file's date/timestamp, that is make it to be now.
doskey touch=copy $1 + ,,$Tdir $1
e) Search for a file through all drives.
doskey where=for %f in (c d e f g h) do dir %f:\$1 /s /p /b
f) Show current time without changing it
doskey showtime=echo.$Btime$Techo.$Bdate
g) Perform a command, skipping a file (wildcards allowed).
doskey skip=attrib +h $1$T$2 $3 $4 $5 $6 $7 $8 $9$Tattrib -h $1